package com.yc.io.img;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;

import javax.imageio.ImageIO;

public class TestGraphics {
	
	public void drawLine() {
		
	}
	
	/**
	 * 画一个背景图片
	 */
	public void drawBackGround(String destPath, int destWeight, int destHeight, String imgType) throws IOException {
		final File file = new File(destPath);

    	if (file.exists()) {
			file.delete();
			file.createNewFile();
		}
		
		BufferedImage bi = new BufferedImage(destWeight, destHeight, BufferedImage.TYPE_INT_BGR);
		Graphics g = bi.getGraphics();
        g.setColor(new Color(255, 255, 255));
        g.fillRect(0, 0, destWeight, destHeight);
        g.dispose();
        ImageIO.write(bi, imgType, file);
	}

	public static void main(String[] args) {
		//画一个背景
		

	}

}
